<template>
    <div>
        welcome to this site
    </div>
    <div>
        <el-button @click="logout()">logout</el-button>
    </div>
</template>

<script setup>
import {get} from "@/net";
import router from "@/router"
import {useStore} from "@/stores"

const store = useStore()

const logout = () => {
    get('/api/auth/logout', (message) => {
        ElMessage.success(message)
        store.auth.user = null
        router.push("/")
    })
}
</script>

<style scoped>

</style>
